<template>
  <view class="release-container">
    <HeaderBar :title="'意见反馈'"/>
    <!-- 内容区域 -->
    <textarea
      class="content-input"
      v-model="content"
      placeholder="请输入内容"
      placeholder-style="color: #666;"
    />

    <!-- 发布按钮 -->
    <button class="submit-btn" @click="handleSubmit" >发布</button>
  </view>
</template>

<script setup>
import { ref,onMounted } from 'vue'
import HeaderBar from '@/components/HeaderBar'
import axios from 'axios'

const content = ref('')
const user_id = ref('')

onMounted(()=>{
  user_id.value = uni.getStorageSync('userInfo')[0]._id
  console.log(user_id.value);
  
})
const handleSubmit = () => { 
    axios.post('http://localhost:3000/add_fk', {
      user_id:user_id.value,
      title:content.value,
      pl_list:[]
    }).then(res=>{
      if(res.data.code === 200){
        uni.navigateTo({url:'/pages/Feedback/Feedback'})
      }
    })
  }
</script>

<style scoped>
.release-container {
  min-height: 100vh;
  background-color: #f5f7fa;
  padding: 20rpx;
}

.content-input {
  width: 100%;
  height: 400rpx;
  background-color: #fff;
  border-radius: 16rpx;
  padding: 30rpx;
  font-size: 30rpx;
  color: #333;
  border: 1rpx solid #e4e6eb;
  box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.05);
}

.submit-btn {
  margin-top: 40rpx;
  background: linear-gradient(135deg, #27ba9b, #1f9d82);
  color: #fff;
  border-radius: 44rpx;
  height: 88rpx;
  line-height: 88rpx;
  font-size: 32rpx;
  transition: all 0.3s;
}

.submit-btn:active {
  opacity: 0.9;
  transform: scale(0.98);
}
</style>